package se.topshelf.golftracker.web.controller.continent;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.validation.Validator;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;
import se.topshelf.golftracker.core.domain.Continent;
import se.topshelf.golftracker.core.service.BaseService;
import se.topshelf.golftracker.core.service.PlayerService;
import se.topshelf.golftracker.web.controller.BaseEntityController;

import javax.annotation.Resource;

/**
 *
 */
@Controller
@SessionAttributes("entity")
@RequestMapping("/continent")
public class ContinentController extends BaseEntityController<Continent> {
    static final String CONTINENT_URL_CONTEXT = "continent";
    @Resource
    private PlayerService playerService;


    public ContinentController() {
        super(Continent.class);
    }

    @Override
    protected Validator getValidator() {
        return new ContinentValidator(playerService);
    }

    @Override
    protected BaseService getBaseService() {
        return playerService;
    }

    @Override
    protected String getEntityUrlContextPath() {
        return CONTINENT_URL_CONTEXT;
    }

    @Override
    protected void addModelReferenceData(ModelMap model, Continent entity) {
        // Do nothing
    }
}
